package com.wechat.entity;

import com.swak.App;
import com.swak.annotation.Column;
import com.swak.annotation.Table;
import com.swak.persistence.BaseMapper;
import com.swak.persistence.Model;

import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

/**
 * 描述
 * 
 * @author Auto Generator
 * @date 2022-10-21T23:59:27.243629400
 */
@Getter
@Setter
@Accessors(chain = true)
@Table(value="WECHAT_CHAT", useMerge = true)
public class Chat extends Model<Chat, String> {
	
	@lombok.EqualsAndHashCode.Exclude
	@lombok.ToString.Exclude
	private static volatile transient BaseMapper<Chat, String> _mapper;
	
	public static final String Id = "ID";
	public static final String Type = "TYPE";
	public static final String NickName = "NICK_NAME";
	public static final String ChatOrder = "CHAT_ORDER";
	public static final String UnReadCount = "UN_READ_COUNT";
	public static final String LastMsgContent = "LAST_MSG_CONTENT";
	public static final String LastMsgType = "LAST_MSG_TYPE";
	public static final String LastMsgDate = "LAST_MSG_DATE";
	public static final String LastMsgId = "LAST_MSG_ID";
	public static final String OthersAtMe = "OTHERS_AT_ME";
	public static final String MsgSequence = "MSG_SEQUENCE";
	public static final String ContactCount = "CONTACT_COUNT";
	public static final String IsAlert = "IS_ALERT";
	public static final String IsTop = "IS_TOP";
	public static final String IsDel = "IS_DEL";
	public static final String IsHide = "IS_HIDE";
	public static final String IsFriend = "IS_FRIEND";
	public static final String IsDnn = "IS_DNN";
	public static final String CreateDate = "CREATE_DATE";
	public static final String UpdateDate = "UPDATE_DATE";
	public static final String DelFlag = "DEL_FLAG";
	public static final String DelAt = "DEL_AT";
	
	private Byte type;
	private String nickName;
	private Integer chatOrder;
	private Integer unReadCount;
	private String lastMsgContent;
	private Byte lastMsgType;
	private java.time.LocalDateTime lastMsgDate;
	private Long lastMsgId;
	private Byte othersAtMe;
	@Column(stat = true)
	private Long msgSequence;
	private Integer contactCount;
	private Byte isAlert;
	private Byte isTop;
	private Byte isHide;
	private Byte isFriend;
	private Byte isDnn;
	private Byte isDel;
	
	@Override
	public String prePersist() {
		return this.initDates();
	}
	
	@Override
	@SuppressWarnings("unchecked")
	protected BaseMapper<Chat, String> getSqlRunner() {
		if (_mapper == null) {
			synchronized (Chat.class) {
				if (_mapper == null) {
					_mapper = (BaseMapper<Chat, String>) App.getBean(getTableDefine().getMapper());
				}
			}
		}
		return _mapper;
	}
	
	public static Chat of() {
	    return new Chat();
	}
}
